Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add webassembly build #70697

Merged
merged 43 commits into from
Jan 9, 2024
Merged

add webassembly build #70697

merged 43 commits into from
Jan 9, 2024

Conversation

nornagon
Copy link
Contributor

@nornagon nornagon commented Jan 6, 2024

Summary

Build "Added WebAssembly build via Emscripten"

Purpose of change

It's handy to be able to run Cataclysm in a browser :3

Describe the solution

This is a continuation of work done by @rameshvarun in https://github.com/rameshvarun/cdda-web, updated to modern versions of Cataclysm and Emscripten, and cleaned up somewhat.

You can try it out at https://nornagon.github.io/play-cdda/.

I'd like to bring this in-tree. The state of this PR is still draft as I'm not sure what the best way is to handle the html/js parts of this (should those live in this repo, or somewhere else?) and because there are a couple more bugs I'd like to iron out (e.g. pressing ESC on the title screen still pops up the quit menu, even though the web version isn't quittable).

Describe alternatives you've considered

I could keep this as a floating patchset and build in a separate repo.

Testing

I haven't done any automated testing but you can try it out at https://nornagon.github.io/play-cdda/. I haven't tested extensively.

Additional context

@github-actions github-actions bot added Code: Build Issues regarding different builds and build environments Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` labels Jan 6, 2024
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 6, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 6, 2024
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Jan 6, 2024
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Jan 6, 2024
@nornagon nornagon marked this pull request as ready for review January 6, 2024 23:51
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @Qrox

@Cenness
Copy link

Cenness commented Jan 7, 2024

I suppose loading custom mods and config folder would be non-trivial?

@nornagon
Copy link
Contributor Author

nornagon commented Jan 7, 2024

I suppose loading custom mods and config folder would be non-trivial?

It's not out of the question, within the limitations of the browser (i.e. you'd have to specifically give the browser access to those folders), but I think it's out of scope for the first pass at this.

@Maleclypse Maleclypse merged commit 149d666 into CleverRaven:master Jan 9, 2024
25 of 26 checks passed
@nornagon nornagon deleted the emscripten-new branch January 10, 2024 04:30
emsdk install 3.1.51
emsdk activate 3.1.51

make -j`nproc` NATIVE=emscripten BACKTRACE=0 TILES=1 TESTS=0 RUNTESTS=0 RELEASE=1 cataclysm-tiles.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if ccache works with emcc so we can reduce build times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is definitely worth looking into.

- name: Assemble web bundle
run: ./build-scripts/prepare-web.sh

- name: Create artifact
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #70870 is now uploading WebAssembly builds, should we remove this step here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still handy for development—the emscripten SDK doesn't work well on macOS or Windows, so it's handy to be able to download the built artifact from CI for testing. I'm not aware of any major downsides to uploading it.

Copy link
Member

@BrettDong BrettDong Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought upload-artifact shares the total GitHub Actions storage limit of the repository, so too many build artifact uploads could evict other data like ccache.

But I just re-checked GitHub Actions doc and it only says GitHub Actions storage usage is free for public repositories without mentioning storage limits or data eviction policy, so I'm not too sure now.

@nornagon
Copy link
Contributor Author

nornagon commented Jan 15, 2024 via email

nornagon pushed a commit to nornagon/Cataclysm-DDA that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Code: Build Issues regarding different builds and build environments Code: Tooling Tooling that is not part of the main game but is part of the repo. Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants